/*kZime*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <cstdlib>
#include <algorithm>
#define MAXN 160
using namespace std;
/*-----------------------------------------------------------------------------*/
inline void File_Read() {
#ifndef MYLAB
	freopen("reroads.in", "r", stdin);
	freopen("reroads.out", "w", stdout);
#else
	freopen("in.txt", "r", stdin);
#endif
}

inline int get_num() {
	int k = 0, f = 1; char c = getchar();
	for(; !isdigit(c); c = getchar())if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
	return k * f;
}

int n, dp[MAXN][MAXN], p, cnt, head[MAXN];

struct edge {
	int fr;
	int to;
	int ne;
	edge() {;}
	edge(int fr_, int to_, int ne_) {
		fr = fr_;
		to = to_;
		ne = ne_;
	}
}e[MAXN << 1];

void add(int to, int fr) {
	e[++cnt] = edge(fr, to, head[fr]), head[fr] = cnt;
	e[++cnt] = edge(to, fr, head[to]), head[to] = cnt;
}

void dfs(int x, int fa) {
	dp[x][1] = 0;
	for(int k = head[x]; k; k = e[k].ne) {
		int y = e[k].to;
		if(y == fa) continue;
		dfs(y, x);
		for(int i = p; i >= 1; i--) {
            int tmp = dp[x][i] + 1;
            for(int j = 0; j <= i; j++)
                tmp = min(tmp, dp[x][j] + dp[y][i - j]);
            dp[x][i] = tmp;
        }
	}
}

int main() {
	File_Read();
	n = get_num();
	p = get_num();
	memset(dp, 0x7f >> 1, sizeof(dp));
	for(int i = 1; i < n; i++) {
		add(get_num(), get_num());
	}
	dfs(1, 0);
	int ans = dp[1][p];
	for(int i = 1; i <= n; i++) {
		ans = min(ans, dp[i][p] + 1);
	}
	printf("%d\n", ans);
	return 0;
}

